package com.buba.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.buba.pojo.system.Health;
import com.buba.pojo.user.Campus;
import com.buba.user.mapper.CampusMapper;
import com.buba.user.service.CampusService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.buba.utils.R;

import java.util.List;

/**
 * <p>
 * 院区表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2022-06-09
 */
@Service
public class CampusServiceImpl extends ServiceImpl<CampusMapper, Campus> implements CampusService {

    @Autowired
    private CampusMapper campusMapper;


    /**
     * @Author 梁玉杰
     * @Description //所有院区列表
     * @Return com.buba.utils.R
     * @throws
     * @Date 2022/6/10 16:00
     **/
    @Override
    public R findAllCampus() {
        List<Campus> campusList = this.list();
        return R.ok().data("list", campusList);
    }

    /**
     * @Author 梁玉杰
     * @Description //院区详情
     * @Return com.buba.utils.R
     * @throws
     * @Date 2022/6/10 16:06
     **/
    @Override
    public R findByCampusID(Integer id) {
        Campus campus = baseMapper.selectById(id);
        return R.ok().data("campus", campus);
    }

    public List<Campus> getHospitals() {
        return this.campusMapper.getHospitals();
    }
}
